package com.swind.fast.modules.app.railway.permission.service.impl;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.swind.fast.common.system.base.service.impl.SwindServiceImpl;
import com.swind.fast.modules.app.railway.permission.entity.RailwayPermission;
import com.swind.fast.modules.app.railway.permission.mapper.RailwayRolePermissionMapper;
import com.swind.fast.modules.app.railway.permission.service.IRailwayPermissionService;

import com.swind.fast.common.railway.api.IRailwayBaseApi;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description: 项目
 */
@Slf4j
@Service
public class RailwayBaseApiImpl implements IRailwayBaseApi {

    @Autowired
    private IRailwayPermissionService railwayPermissionService;

    @Override
    public void getRailwayAuthPermission(JSONArray railwayAuthjsonArray) {
        List<RailwayPermission> list = railwayPermissionService.list();
        log.info("getRailwayAuthPermission: {}", list);

        JSONObject json = null;
        for (RailwayPermission permission : list) {
            json = new JSONObject();
            json.put("action", permission.getPermCode());
            // json.put("status", permission.getStatus());
            // json.put("type", permission.getPermsType());
            json.put("describe", permission.getName());
            railwayAuthjsonArray.add(json);
        }
    }
}
